home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
compress
/
unix
/
unz50p1.zoo
/
unzip.h
< prev
next >
Wrap
C/C++ Source or Header
|
1993-01-11
|
43KB
|
1,244 lines
/*---------------------------------------------------------------------------
unzip.h
This header file is used by all of the unzip source files. Its contents
are divided into seven more-or-less separate sections: predefined macros,
OS-dependent includes, (mostly) OS-independent defines, typedefs, function
prototypes (or "prototypes," in the case of non-ANSI compilers), macros,
and global-variable declarations.
---------------------------------------------------------------------------*/
/*****************************************/
/* Predefined, Machine-specific Macros */
/*****************************************/
#if (defined(__GO32__) && defined(unix)) /* DOS extender */
# undef unix
#endif
#if defined(unix) || defined(__convexc__) || defined(M_XENIX)
# ifndef UNIX
# define UNIX
# endif /* !UNIX */
#endif /* unix || __convexc__ || M_XENIX */
/* Much of the following is swiped from zip's tailor.h: */
/* define MSDOS for Turbo C (unless OS/2) and Power C as well as Microsoft C */
#ifdef __POWERC
# define __TURBOC__
# define MSDOS
#endif /* __POWERC */
#if (defined(__TURBOC__) && defined(__MSDOS__) && !defined(MSDOS))
# define MSDOS
#endif
/* use prototypes and ANSI libraries if __STDC__, or Microsoft or Borland C,
* or Silicon Graphics, or Convex, or IBM C Set/2, or GNU gcc under emx, or
* or Watcom C, or Macintosh, or Windows NT.
*/
#if (__STDC__ || defined(MSDOS) || defined(sgi) || defined(CONVEX))
# ifndef PROTO
# define PROTO
# endif
# define MODERN
#endif
#if (defined(__IBMC__) || defined(__EMX__) || defined(__WATCOMC__))
# ifndef PROTO
# define PROTO
# endif
# define MODERN
#endif
#if (defined(THINK_C) || defined(MPW) || defined(WIN32))
# ifndef PROTO
# define PROTO
# endif
# define MODERN
#endif
/* turn off prototypes if requested */
#if (defined(NOPROTO) && defined(PROTO))
# undef PROTO
#endif
/* used to remove arguments in function prototypes for non-ANSI C */
#ifdef PROTO
# define OF(a) a
#else /* !PROTO */
# define OF(a) ()
#endif /* ?PROTO */
#if (defined(ultrix) || defined(bsd4_2) || defined(sun) || defined(pyr))
# if (!defined(BSD) && !defined(__SYSTEM_FIVE) && !defined(SYSV))
# define BSD
# endif /* !BSD && !__SYSTEM_FIVE && !SYSV */
#endif /* ultrix || bsd4_2 || sun || pyr */
#if (defined(CONVEX) || defined(CRAY) || defined(__SYSTEM_FIVE))
# ifndef TERMIO
# define TERMIO
# endif /* !TERMIO */
#endif /* CONVEX || CRAY || __SYSTEM_FIVE */
#ifdef pyr /* Pyramid */
# ifndef ZMEM
# define ZMEM
# endif /* !ZMEM */
#endif /* pyr */
#ifdef CRAY
# ifdef ZMEM
# undef ZMEM
# endif /* ZMEM */
#endif /* CRAY */
/* the i386 test below is to catch SCO Unix (which has redefinition
* warnings if param.h is included), but it probably doesn't hurt if
* other 386 Unixes get nailed, too...except now that 386BSD and BSDI
* exist. Sigh. <sys/param.h> is mostly included for "BSD", I think.
* [An alternate fix for SCO Unix is below.]
*/
#if (defined(MINIX) || (defined(i386) && defined(unix)))
# define NO_PARAM_H
#endif /* MINIX || (i386 && unix) */
/***************************/
/* OS-Dependent Includes */
/***************************/
#ifndef MINIX /* Minix needs it after all the other includes (?) */
# include <stdio.h>
#endif
#include <ctype.h> /* skip for VMS, to use tolower() function? */
#include <errno.h> /* used in mapname() */
#ifndef NO_ERRNO
# define DECLARE_ERRNO /* everybody except MSC 6.0, SCO cc, Watcom C/386 */
#endif /* !NO_ERRNO */
#ifdef VMS
# include <types.h> /* (placed up here instead of in VMS section below */
# include <stat.h> /* because types.h is used in some other headers) */
#else /* !VMS */
# if !defined(THINK_C) && !defined(MPW)
# include <sys/types.h> /* off_t, time_t, dev_t, ... */
# include <sys/stat.h>
# endif /* !THINK_C && !MPW */
#endif /* ?VMS */
#ifdef MODERN
# if (!defined(M_XENIX) && !(defined(__GNUC__) && defined(sun)))
# include <stddef.h>
# endif
# if (!defined(__GNUC__) && !defined(apollo)) /* both define __STDC__ */
# include <stdlib.h> /* standard library prototypes, malloc(), etc. */
# else
# ifdef __EMX__
# include <stdlib.h> /* emx IS gcc but has stdlib.h */
# endif
# endif
# include <string.h> /* defines strcpy, strcmp, memcpy, etc. */
typedef size_t extent;
typedef void voidp;
#else /* !MODERN */
char *malloc();
char *strchr(), *strrchr();
long lseek();
typedef unsigned int extent;
# define void int
typedef char voidp;
#endif /* ?MODERN */
/* this include must be down here for SysV.4, for some reason... */
#include <signal.h> /* used in unzip.c, file_io.c */
/*---------------------------------------------------------------------------
Next, a word from our Unix (mostly) sponsors:
---------------------------------------------------------------------------*/
#ifdef UNIX
# ifdef AMIGA
# include <libraries/dos.h>
# else /* !AMIGA */
# ifndef NO_PARAM_H
#if 0 /* [GRR: this is an alternate fix for SCO's redefinition bug] */
# ifdef NGROUPS_MAX
# undef NGROUPS_MAX /* SCO bug: defined again in <param.h> */
# endif /* NGROUPS_MAX */
#endif /* 0 */
# include <sys/param.h> /* conflict with <sys/types.h>, some systems? */
# endif /* !NO_PARAM_H */
# endif /* ?AMIGA */
# ifndef BSIZE
# ifdef MINIX
# define BSIZE 1024
# else /* !MINIX */
# define BSIZE DEV_BSIZE /* assume common for all Unix systems */
# endif /* ?MINIX */
# endif
# ifndef BSD
# if (!defined(AMIGA) && !defined(MINIX))
# define NO_MKDIR /* for mapname() */
# endif /* !AMIGA && !MINIX */
# include <time.h>
struct tm *gmtime(), *localtime();
# else /* BSD */
# include <sys/time.h>
# include <sys/timeb.h>
# ifdef _AIX
# include <time.h>
# endif
# endif
#else /* !UNIX */
# define BSIZE 512 /* disk block size */
#endif /* ?UNIX */
#if (defined(V7) || defined(BSD))
# define strchr index
# define strrchr rindex
#endif
/*---------------------------------------------------------------------------
And now, our MS-DOS and OS/2 corner:
---------------------------------------------------------------------------*/
#ifdef __TURBOC__
# define DOS_OS2
# include <sys/timeb.h> /* for structure ftime */
# ifndef __BORLANDC__ /* there appears to be a bug (?) in Borland's */
# include <mem.h> /* MEM.H related to __STDC__ and far poin- */
# endif /* ters. (dpk) [mem.h included for memcpy] */
# include <dos.h> /* for REGS macro (at least for Turbo C 2.0) */
#else /* NOT Turbo C (or Power C)... */
# ifdef MSDOS /* but still MS-DOS, so we'll assume it's */
# ifndef MSC /* Microsoft's compiler and fake the ID, if */
# define MSC /* necessary (it is in 5.0; apparently not */
# endif /* in 5.1 and 6.0) */
# include <dos.h> /* for _dos_setftime() */
# endif
#endif
#if (defined(__IBMC__) && defined(__OS2__))
# define DOS_OS2
# define S_IFMT 0xF000
# define timezone _timezone
#endif
#ifdef __WATCOMC__
# define DOS_OS2
# define __32BIT__
# ifdef DECLARE_ERRNO
# undef DECLARE_ERRNO
# endif
# undef far
# define far
#endif
#ifdef __EMX__
# define DOS_OS2
# define __32BIT__
# define far
#endif /* __EMX__ */
#ifdef MSC /* defined for all versions of MSC now */
# define DOS_OS2 /* Turbo C under DOS, MSC under DOS or OS/2 */
# if (defined(_MSC_VER) && (_MSC_VER >= 600)) /* new with 5.1 or 6.0 ... */
# undef DECLARE_ERRNO /* errno is now a function in a dynamic link */
# endif /* library (or something)--incompatible with */
#endif /* the usual "extern int errno" declaration */
#ifdef DOS_OS2 /* defined for all MS-DOS and OS/2 compilers */
# include <io.h> /* lseek(),